package com.sumainfor.pc.gmio.controller.assistant;

import com.sumainfor.common.util.FieldCheckUtil;
import com.sumainfor.common.util.JsonResult;
import com.sumainfor.common.utlis.Pager;
import com.sumainfor.pc.gmio.feign.Zfeign.ZpcMktFeign;
import com.sumainfor.pc.gmio.feign.ZuulFeign.ZuulFeign;
import com.sumainfor.pc.gmio.service.WorkBenchManageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * @Author Eddy·Chen
 * @Email 835033913@qq.com
 * @Create 2019-04-12 19:30
 * 运营经理和助理工作台
 */
@RestController
@RequestMapping("/manage")
public class WorkBenchManageController {


    @Autowired
    WorkBenchManageService workBenchManageService;

    @Autowired
    ZuulFeign zuulFeign;

    @Autowired
    ZpcMktFeign zpcMktFeign;


    /**
    * <p>
    *  重要状态提醒
    * </p>
    *
    * @author: zhoucong
    * @since:
    */
     @GetMapping("/importantState")
    public JsonResult importantState(){
        return workBenchManageService.importantState();
     }


    /**
     * <p>
     * 系统消息提醒
     * </p>
     *
     * @author: zhoucong
     * @since:
     */
    @ResponseBody
    @GetMapping("/systemMessage")
    public JsonResult systemMessage(@RequestParam Map<String,Object> params, Pager pager){
        System.out.println("params"+params);
        JsonResult result = new JsonResult();
        if(!FieldCheckUtil.isMapFieldNotNull(params ,new String[]{"MeType"})){
            return  result.putFailed("消息角色不能为空...");
        }
        return zuulFeign.getMessageList(params,pager);
    }

    /**
    * <p>
    * 日账单核对
    * </p>
    *
    * @author: zhoucong
    * @since:
    */
    @ResponseBody
    @GetMapping("/dailyBillAudit")
    //不用错误的
    public JsonResult dailyBillAudit(){
        return workBenchManageService.dailyBillAudit();
    }


    /**
    * <p>
    * 续租率（月，季度，年）
    * </p>
    *
    * @author: zhoucong
    * @since:
    */
    @ResponseBody
    @GetMapping("/forRenewal")
    public JsonResult forRenewal(@RequestParam Map<String,Object> params){
        return zpcMktFeign.forRenewal(params);
    }




}
